<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
    <!-- 百度禁止转码 -->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait" />
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrai" />
    <!-- 禁用电话号码邮箱自动识别 -->
    <meta name="format-detection" content="telephone=no,email=no" />
    <title>document</title>
    <link rel="stylesheet" href="./css/light.min.css" id="light" />
  </head>

  <body>
    <button id="btn">分享</button>
    <script>
      document.getElementById('btn').addEventListener('click', function() {
        if (navigator.share) {
          navigator
            .share({
              title: 'WebShare API Demo',
              text: 'Hello World',
              url: location.href
            })
            .then(() => {
              console.log('Thanks for sharing!')
            })
        } else {
          window.alert('此浏览器不支持分享')
        }
      })
    </script>
  </body>
</html>
